angular.module('app').directive('appHeader', ['$state', function($state) {
	return {
		restrict: 'AE',
		replace: true,
		templateUrl: 'views/template/header.html',
		scope: {
			left: '@',
			center: '@',
			right: '@',
			white: '@',
			isapp: '='
		},
		link: function(scope) {
			scope.goback = function() {
				window.history.go(-1)
			}
			scope.gourl = function() {
				if(scope.right == "完成") {
					$state.go("user")
				}
				if(scope.right == "已到期") {
					$state.go("Expired")
				}
				if(scope.right == "收支明细") {
					$state.go("collect_details")
				}
				if(scope.right=="使用说明"){
					location.href="protocol/red_packet.html"
				}
			}

		}
	}

}])